package com.PuzGame.combinenumbers.Activities;

import java.lang.reflect.Type;
import java.util.ArrayList;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Handler;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.NumberPicker;
import android.widget.NumberPicker.OnValueChangeListener;
import android.widget.TextView;
import android.widget.Toast;

import com.PuzGame.combinenumbers.ChallengeeLevel;
import com.PuzGame.combinenumbers.ChallengerLevel;
import com.PuzGame.combinenumbers.Level;
import com.PuzGame.combinenumbers.R;
import com.PuzGame.combinenumbers.Tools;
import com.PuzGame.combinenumbers.Interfaces.IGetDataResponse;
import com.PuzGame.combinenumbers.Interfaces.IPostDataResponse;
import com.PuzGame.combinenumbers.ServerCommunication.GetDataAsyncTask;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

public class ChallengeActivity extends Activity implements IGetDataResponse, IPostDataResponse {

	
	private IGetDataResponse GetCallback;
	private Handler m_handler = new Handler();
	
	Runnable m_handlerTask = new Runnable() {

	    @Override
	    public void run() {
	        m_handler.postDelayed(m_handlerTask, 60*1000);
	             new GetDataAsyncTask(GetCallback).execute("http://karmeloz.no-ip.org/ctn/rest/challenge/all");
	    }
	};
	

	
	private void startGettingDataTask()
	{
	    m_handlerTask.run(); 
	}

	private void stopGettingDataTask()
	{
	    m_handler.removeCallbacks(m_handlerTask);
	}

	@Override
	public void GetResponse(String res) {
		// TODO Auto-generated method stub
		Toast.makeText(this,
				res,
				Toast.LENGTH_LONG)
				.show();
		
	}

	@Override
	public void PostResponse(String res) {
		// TODO Auto-generated method stub
		Toast.makeText(this,
				res,
				Toast.LENGTH_LONG)
				.show();
		
	}
	
	
}
